<!--
 * Copyright 2019 ia-cloud project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 -->

<script type="text/html" data-template-name="object-array">


    <!-- objectArrayの設定 -->
    <div class="form-row">
        <label for="node-input-interval">
            <span data-i18n="editor.period"></span></label>
        <input type="number" id="node-input-interval" min="0" max="86400" step="10"
            value="300" style="display: inline-block; width: 80px;">
        <label style="width: 30px;">
            <span data-i18n="editor.sec"></span></label>
        <label for="node-input-length">
            <span data-i18n="editor.length"></span></label>
        <input type="number" id="node-input-length" min="1" step="1" max="100"
            value="30" style="display: inline-block; width: 80px;" >
    </div>
    <div class="form-row">
        <label for="node-input-objectKey"><span data-i18n="editor.objectKey"></span></label>
        <input class="form-control" type="text" style="width: 300px"
        id="node-input-objectKey" data-i18n="[placeholder]editor.objectKeyholder">
    </div>
    <div class="form-row">
        <label 
            for="node-input-objectdescription"><span data-i18n="editor.objectDescription"></span></label>
        <input type="text" style="width: 300px" id="node-input-objectDescription">
    </div>
    <hr>
    <div class="form-row">
        <label for="node-input-name" ><i class="fa fa-tag"></i><span data-i18n="editor.name"></span></label>
        <input type="text" class="form-control" id="node-input-name" data-i18n="[placeholder]editor.name">
    </div>
      
</script>

<script type="text/javascript">

  RED.nodes.registerType('object-array',{
    category: 'iaCloud services',
    color:"rgb(231, 180, 100)",
    defaults: {
        name: {value:""},
        interval: { value: 10, required: true},
        length: { value: 30, required: true},
        objectKey: { value: '', required: true},
        objectDescription: { value: '' },
    },
    inputs:1,
    outputs:1,
    icon: "ia-cloud.png",
    paletteLabel: function() {
            return this._("editor.palletLabel") || "iaCloud Object array";
        },
    label: function() {
        return this.name||this._("editor.palletLabel");
    },
    labelStyle: function() {
        return this.name?"node_label_italic":"";
    },
    oneditprepare: function() {

    },

    oneditsave: function() {

    }
  });

</script>